<?php
class CMS_Db
{
    const DB_NAMESPACE = "CMS_DB";

    public static function connect($adapter,$host,$username,$password,$dbname)
	{
		//$db = new Zend_Session_Namespace("DB");
		$db = Zend_Db::factory($adapter, array(

	    'host'     => $host,
	    'username' => $username,
	    'password' => $password,
	    'dbname'   => $dbname));

		$db->setFetchMode(Zend_Db::FETCH_ASSOC);

		Zend_Registry::set(self::DB_NAMESPACE,$db);
		return $db;
	}
	/**
	 * Retorna una instancia de la conexion a la DB.
	 *
	 * @return Zend_Db_Adapter_Abstract
	 */
	public static function getInstance()
	{
		return Zend_Registry::get(self::DB_NAMESPACE);
	}
	public static function disconnect()
	{
		Zend_Registry::get(self::DB_NAMESPACE)->closeConnection();
	}
	
	public static function getLastId($tableName)
	{
	}
}
?>
